package org.airlink.persistence.criteria.expressions
{
	import flash.utils.Dictionary;
	
	import flex.persistence.criteria.Expression;
	
	import org.airlink.persistence.criteria.CriteriaBuilderImpl;
	import org.airlink.persistence.criteria.PredicateImpl;
	
	public class Equal extends PredicateImpl {
		private var criteriaBuilder:CriteriaBuilderImpl;

		public function Equal(criteriaBuilder:CriteriaBuilderImpl, x:Expression, y:*) {
			_parameters =  new Array();
			_parameters["x"] = x;
			if(y is Expression)
				_parameters["y"] = y;
			else
				_parameters["y"] = criteriaBuilder.pushParameter(y);
		}
		
		override public function toString():String{
			var result:String = "";
			result += "(";
			result += _parameters["x"];
			result += " = ";
			if(_parameters["y"] is Expression)
				result += _parameters["y"];
			else 
				result += ":p"+_parameters["y"];
			result += ")";
			return result;
		}
		
		
		
	}
}